<?php
namespace app\service\validate;
use think\Validate;
class ServiceUser extends Validate {
    //验证字段
    protected $rule = [
        'chat_id' => ['require','number'],
        'service_chat_id' => ['require'],
        'status' => ['require','number'],
        'is_delete' => ['require','number'],
        'create_time' => ['require','number'],
        'in_service' => ['require','number'],
        'merchant_id' => ['require','number'],
        'service_type' => ['require'],
        'service_name' => ['require'],
        'is_accept' => ['require','number'],
        'is_send' => ['require','number'],
        'user_account_id' => ['require','number'],
        'id' => ['require','number'],
    ];
    //返回消息
    protected $message = [
        'chat_id.require' => '窗口id必须',
        'chat_id.number' => '窗口id不是数字',
        'service_chat_id.require' => '服务id必须',
        'status.require' => '状态必须',
        'status.number' => '状态不是数字',
        'is_delete.require' => '已删除必须',
        'is_delete.number' => '已删除不是数字',
        'create_time.require' => '创建时间必须',
        'create_time.number' => '创建时间不是数字',
        'in_service.require' => '服务中必须',
        'in_service.number' => '服务中不是数字',
        'merchant_id.require' => '商城id必须',
        'merchant_id.number' => '商城id不是数字',
        'service_type.require' => '咨询类型必须',
        'service_name.require' => '名称必须',
        'is_accept.require' => '可接受信息必须',
        'is_accept.number' => '可接受信息不是数字',
        'is_send.require' => '可发送信息必须',
        'is_send.number' => '可发送信息不是数字',
        'user_account_id.require' => '参与用户账号id必须',
        'user_account_id.number' => '参与用户账号id不是数字',
        'id.require' => 'id必须',
        'id.number' => 'id不是数字',
    ];

    // except_id 场景
    public function sceneExcept_id(){
        return $this->only(['chat_id','service_chat_id','status','is_delete','create_time','in_service','merchant_id','service_type','service_name','is_accept','is_send','user_account_id']);
    }

    // only_id 场景
    public function sceneOnly_id(){
        return $this->only(['id']);
    }

    // all_field 场景
    public function sceneAll_field(){
        return $this->only(['id','chat_id','service_chat_id','status','is_delete','create_time','in_service','merchant_id','service_type','service_name','is_accept','is_send','user_account_id']);
    }
}
